#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

string s;
bool cmp(int a,int b){
    return a > b;
}
int main(){
    cin >> s;
    sort(s.begin(),s.end());
    cout << s;
    puts("");
    sort(s.begin(),s.end(),cmp);
    cout << s;

    return 0;
}
